package org.yohailong.studyspringboot.common.util;


import org.yohailong.studycommon.pojo.vo.Response;

/**
 * @author 朱海龙
 * 2024/4/28 17:07
 */
public class ResponseUtil {

    public static <T> Response<T> success(T data) {
        Response<T> response = new Response<>();
        response.setSuccess(Boolean.TRUE);
        response.setCode("0");
        response.setMsg("成功");
        response.setData(data);
        return response;
    }


    public static <T> Response<T> failure(String code, String msg) {
        Response<T> response = new Response<>();
        response.setSuccess(Boolean.FALSE);
        response.setCode(msg);
        response.setMsg(msg);
        response.setData(null);
        return response;
    }
}
